<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 有一个对象来判断是否有该属性 对象['属性名']

        let obj = {
            age: 18,
            old: true,
            sex: false
        }

        let temp = 'age';
        if (obj[temp]) {
            console.log('ok');
        }else{
            console.log('no');
        }
    </script>
</body>
</html>